package com.wm.student;

import java.util.Scanner;

public class TextStudent {
    public static void main(String[] args) {
        Student stu = new Student();
        Scanner s = new Scanner(System.in);
        boolean flag = true;
        int num;
        do{
            System.out.print("1：添加学生信息\t2：删除学生信息\t3：显示学生信息\t（按0退出）：");
            num = s.nextInt();
            switch (num) {
                case 1:
                    System.out.print("姓名：");
                    String name = s.next();
                    System.out.print("学号：");
                    String id = s.next();
                    System.out.print("性别：");
                    String sex = s.next();
                    System.out.print("年龄：");
                    int age = s.nextInt();
                    System.out.print("业余爱好：");
                    String hobby = s.next();
                    Student student = new Student(id, name, age, sex, hobby);
                    stu.add(student);
                    System.out.println("添加成功！");
                    break;
                case 2:
                    System.out.print("请输入你要删除的学生的姓名：");
                    boolean isDel = stu.deleteName(s.next());
                    if (isDel) {
                        System.out.println("删除成功！");
                    } else {
                        System.out.println("错误信息");
                    }
                    break;
                case 3:
                    stu.showName();
                    break;
                default:
                    flag = false;
            }
        }while (flag) ;
    }
}
